<template>
	<view>
		<template v-if="loading">
			<view class='userItem' v-for="item in 10" :key="item">
				<view class="Skeleton" style="width: 80rpx;height: 80rpx;border-radius: 8rpx;" />
				<view class="userInfo">
					<view class="nickNameBox Skeleton" style="width: 100%;height: 30rpx;" />
					<view class="nickNameBox Skeleton" style="width: 100%;height: 30rpx;" />
				</view>
			</view>
		</template>
		<template v-else>
			<view class='userItem' v-for="item in list" :key="item.id" @click="jump(item.id)">
				<image :src="item.user.avatar"></image>
				<view class="userInfo">
					<view class="nickNameBox">
						<view>
							<u--text lines='1' :text='item.user.nick_name' size='24rpx' />
						</view>
						<view>
							{{item.created_at | changeTime}}
						</view>
					</view>
					<view>
						<u--text lines='1' :text='item.motto' size='24rpx' />
					</view>
				</view>

			</view>
			<view v-if="!list.length">
				<empty />
			</view>
		</template>
	</view>
</template>

<script>
	export default {
		props: ['list', 'loading'],
		mounted() {},
		methods: {
			jump(id){
				this.$utils.navigateTo({
					url:'/User/center?id='+id
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.userItem {
		display: flex;
		padding: 10rpx 0;
		border-bottom: 1rpx solid #ddd;

		image {
			width: 80rpx;
			height: 80rpx;
			border-radius: 8rpx;
		}

		.userInfo {
			margin-left: 20rpx;
			flex: 1;
			height: 80rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
		}

		.nickNameBox {
			display: flex;

			>view:nth-child(1) {
				flex: 1;
				margin-right: 10rpx;
			}
		}
	}
</style>